package my.mall.common.util

import my.mall.common.enums.RespMetaEnum
import my.mall.common.exception.WebBaseException
import java.util.concurrent.CompletableFuture
import java.util.concurrent.ExecutionException

object FutureUtils {

    fun waitAllTasks(vararg tasks: CompletableFuture<*>?) {
        try {
            CompletableFuture.allOf(*tasks).get()
        } catch (e: ExecutionException) {
            throw WebBaseException(RespMetaEnum.TIMEOUT, e)
        }
    }
}
